package com.fansl.allround.study.timer;

import java.time.LocalDateTime;
import java.util.concurrent.TimeUnit;

/**
 * @author fansl
 * @Description: TODO
 * @date 2019/11/20 11:07
 */
public class TimerWheelTest implements TimerTask {
    final static Timer timer = new TimerWheel();


    public static void main(String[] args) {
        TimerTask timerTask = new TimerWheelTest();
        for (int i = 0; i < 10; i++) {
            System.out.println(LocalDateTime.now());
            timer.newTimeout(timerTask, (i+1)*5, TimeUnit.SECONDS, "" + i );
        }
    }
    @Override
    public void run(Timeout timeout, String argv) throws Exception {
        System.out.println(LocalDateTime.now());
        System.out.println("timeout, argv = " + argv );
    }
}
